package com.vcredit.creditcat.web.api;

import java.util.List;

import javax.validation.Valid;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.dubbo.config.annotation.Reference;
import com.vcredit.creditcat.api.pc.IIncomeForPcManager;
import com.vcredit.creditcat.dto.BUIGridResultDto;
import com.vcredit.creditcat.dto.income.IncomeForPcDto;
import com.vcredit.creditcat.dto.income.IncomeSearchParamDto;


@Controller
@RequestMapping("income")
public class IncomeController {
	
	@Reference(version = "1.0")
	private IIncomeForPcManager incomeManager;
	
	@RequestMapping("list")
	@ResponseBody
	public BUIGridResultDto<IncomeForPcDto> list(@Valid @RequestBody IncomeSearchParamDto param) {
		return incomeManager.pageQuery(param);
	}
	
	@RequestMapping("add")
	@ResponseBody
	public Boolean add(@Valid @RequestBody IncomeForPcDto param) {
		try {
			return incomeManager.add(param);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	
	@RequestMapping("incomeTypeList")
	@ResponseBody
	public List<IncomeForPcDto> incomeTypeList() {
		try {
			return incomeManager.incomeTypeList();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}
